//
//  DHArrowTableViewCell.m
//  DHKuaiYi
//
//  Created by  chenhanmao on 2016/11/13.
//  Copyright © 2016年 30-陈辉华. All rights reserved.



#import "DHArrowTableViewCell.h"
#import <Masonry.h>

@interface DHArrowTableViewCell ()

/**  label  */
@property(nonatomic,weak) UILabel *label;

@end

@implementation DHArrowTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    
    if (self) {
        [self setupUI];
    }
    return self;
}


- (void)awakeFromNib {
    [super awakeFromNib];
    [self setupUI];
}

- (void)setText:(NSString *)text {
    
    _text = text;
    
    self.label.text = text;
}

#pragma mark - 搭建界面
- (void)setupUI {
    
    UILabel *label = [[UILabel alloc] init];
    self.label = label;
    [self.contentView addSubview:label];
    label.text = @"请选择疾病细分";
    label.textColor = [UIColor XHH_colorWithHex:0x525252];
    label.font = [UIFont systemFontOfSize:14];
    
    UIView *divView = [[UIView alloc] init];
    [self.contentView addSubview:divView];
    [divView setBackgroundColor:[UIColor colorWithRed:0.94 green:0.94 blue:0.96 alpha:1.00]];
    
    UIButton *arrowBtn = [[UIButton alloc] init];
    [self.contentView addSubview:arrowBtn];
    [arrowBtn setImage:[UIImage imageNamed:@"pic_cell_green_accessory_img"] forState:UIControlStateNormal];
    [arrowBtn addTarget:self action:@selector(selectedSomethingYoulike) forControlEvents:UIControlEventTouchUpInside];
    
    
    /*------------------自动布局------------------*/
    CGFloat marginLeft = 10;
    CGFloat marginRight = 16;
    [label mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.equalTo(self.contentView).offset(marginLeft);
        make.centerY.equalTo(self.contentView);
    }];
    
    [arrowBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.right.equalTo(self.contentView).offset(-marginRight);
        make.centerY.equalTo(self.contentView);
        make.size.mas_equalTo(CGSizeMake(marginRight, marginRight));
    }];
    
    [divView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.right.equalTo(arrowBtn.mas_left).offset(-marginRight);
        make.top.equalTo(self.contentView).offset(4);
        make.bottom.equalTo(self.contentView).offset(-4);
        make.width.mas_equalTo(2);
    }];
}


- (void)selectedSomethingYoulike {
    
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
